package Bank;

public class BOCTest {
	public static void main(String[] args) throws Exception {
		String mingwen = "1|1970-01-01 08:00:00.0|001|1.00|1";
		byte[] data = mingwen.getBytes();
		
		// 签名4
		PKCS7Tool JQ4 = PKCS7Tool.getSigner("src/main/config/4.pfx", "111111", "111111");
		String signData4 = JQ4.sign(data);
		System.out.println("signData1: \n" + signData4);
		
		// 验签4
/*		PKCS7Tool YQ4 = PKCS7Tool.getVerifier("src/main/config/44.cer");
		YQ4.verify(signData4, data, "CN=测试商户, OU=TEST, O=BANK OF CHINA, C=CN");*/
		
		// 签名3
		PKCS7Tool JQ3 = PKCS7Tool.getSigner("src/main/config/3.pfx", "11111111", "11111111");
		String signData3 = JQ3.sign(data);
		System.out.println("signData3: \n" + signData3);
		
		// 验签3
		PKCS7Tool YQ3 = PKCS7Tool.getVerifier("src/main/config/3.cer");
/*		String mingwen2 = "1|1970-01-01 08:00:00.0|001|1.00|1";
		byte[] data2 = mingwen2.getBytes();*/
		YQ3.verify(signData3, data, "CN=测试商户, OU=TEST, O=BANK OF CHINA, C=CN");

//-------------------------------------------------------------------------------------------------------------------------
/*		// 签名2
		PKCS7Tool JQ2 = PKCS7Tool.getSigner("src/main/config/2.pfx", "11111111", "11111111");
		String signData2 = JQ2.sign(data);
		System.out.println("signData2: \n" + signData2);
		
		// 验签2
		PKCS7Tool YQ2 = PKCS7Tool.getVerifier("src/main/config/2.cer");
		YQ2.verify(signData2, data, "CN=淘宝网TEST, O=BANK OF CHINA, C=CN");
		
//-------------------------------------------------------------------------------------------------------------------------
		// 签名1
		PKCS7Tool JQ = PKCS7Tool.getSigner("src/main/config/11.pfx", "111111", "111111");
		String signData = JQ.sign(data);
		System.out.println("signData1: \n" + signData);
		
		// 验签1
		PKCS7Tool YQ = PKCS7Tool.getVerifier("src/main/config/11.cer");
		YQ.verify(signData, data, "CN=铁道部资金清算中心_0c7192965f46f7a0e9069c90016596ff55da3073_铁道部_11,C=CN");*/
	}
}
